#======================================================================
# PURPOSE : Dealing with Higher dimensional arrays
#======================================================================
import numpy as np

#----------------------------------------------------------------------------
#     Creating a 3D array (By treating it as slice of multiple 2D arrays)
#----------------------------------------------------------------------------
a=np.array([(1,2,3,4),(5,6,7,8),(9,10,11,12)])
b=np.array([(10,20,30,40),(50,60,70,80),(90,100,110,120)])
d=np.ones((3,4,2))

d[:,:,0]=a;
d[:,:,1]=b;
#----------------------------------------------------------------------------
#                    Printing 3D array (slice by slice)
#----------------------------------------------------------------------------
print("---------------------------- 1")
print(d[:,:,0])
print(d[:,:,1])

#-----------------------------------------------------------------------
#             Accessing the elements of array
#-----------------------------------------------------------------------
print("---------------------------- 2")
e=d[1,2,1]
print("Element at index (1,2,1) is ...",e)

#-----------------------------------------------------------------------
#     Creating a 3D array (By direct method)
#-----------------------------------------------------------------------
print("---------------------------- 3")
f=np.array([[[1,10],[2,20],[3,30],[4,40]],[[5,50],[6,60],[7,70],[8,80]],[[9,90],[10,100],[11,110],[12,120]]])
print("Printing by slice by clice method ...")
print(f[:,:,0])
print(f[:,:,1])
print("Printig Directly ...")
print(f)
print("Completed Successfully")
